home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / gus / sdkdigv2.zip / SDKV2N7.TXT < prev    next >
Encoding:
Text File  |  1993-06-23  |  4.8 KB  |  137 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6. GUS Programmer's Digest     Wed Jun  9 00:07     Volume 2: Issue   7  
  7.  
  8. Today's Topics:
  9.                Q: Programming GUS and Double Buffering
  10.  
  11. Standard Info:
  12.     - Meta-info about the GUS can be found at the end of the Digest.
  13.     - Before you ask a question, please READ THE FAQ.
  14.  
  15. ----------------------------------------------------------------------
  16.  
  17. Date: Tue, 8 Jun 1993 08:40:35 GMT
  18. From: av@omega.ssw.de (Andreas Vogel)
  19. Subject: Q: Programming GUS and Double Buffering
  20. Message-ID: <1993Jun8.084035.2591@omega.ssw.de>
  21.  
  22. ReprintFrom: comp.sys.ibm.pc.soundcard
  23.  
  24. I have two questions concerning the programming of the GUS. Are there
  25. any GUS wizards out there who could answer my questions?
  26. I've read the GUS SDK and examined all of the supplied code!
  27.  
  28. 1)  I can't get the GUS playing two buffers smoothly (without pops).
  29.     We have, e.g., two buffers in GUS DRAM full with samples. This is a
  30.     part of an Unix device driver, which will do audio file playing using
  31.     double buffering.
  32.  
  33.     I've tried several methods to get these two buffers played alternating.
  34.  
  35.     a)  The first method was to start playing buffer 1, start an volume ramp
  36.     up which will take 20 ms and wait for the WAVE IRQ. After receiving
  37.     the WAVE IRQ, ramp the volume down in 20 ms, wait for the VOL IRQ,
  38.     start the voice on buffer 2 with a ramp up of 20 ms. After buffer 2
  39.     finished just continue with buffer 1 and so on...
  40.  
  41.         Buffer1       Buffer2
  42.       +--,------+   +--,------+
  43.       | /       |\  | /       |\
  44.       |/        | \ |/        | \
  45.       +---------+  `+---------+  `
  46.  
  47.     b)  The method a) uses only one voice. Now try the whole thing with two
  48.     voices. The big difference is that we now start the volume ramp up
  49.     on buffer 2 at the same time as the volume ramp down on buffer 1.
  50.  
  51.         Buffer1   Buffer2
  52.       +--,------+--,------+
  53.       | /voice1 |\/voice2 |\
  54.       |/        |/\       | \
  55.       +---------+--`------+  `
  56.  
  57.  
  58.  
  59.     None of both methods works without popping. I've tried several volume
  60.     ramp rates and volume low settings.
  61.  
  62.     Though, I'm really wondering how to get the problem solved. One idea
  63.     I've had is that the volume ramp down will happen to late. The voice
  64.     on the buffer is then already stopped and maybe this stop generates
  65.     the pop. Maybe a solution would be:
  66.  
  67.     c)  Use two voices. Calculate the sample position when to start the
  68.     volume ramp down for each buffer.
  69.  
  70.         Buffer1   Buffer2
  71.       +--,---,--+--,---,--+
  72.       | /     \ | /     \ |
  73.       |/voice1 \|/voice2 \|
  74.       +---------+---------+
  75.  
  76.     I've not actually tried this method.
  77.  
  78.     It is very time consuming to try more methods (building a new kernel,
  79.     rebooting, ...), so I asking you for your opinion and experience.
  80.  
  81.     The only thing I know for sure is that it is possible, but how?
  82.  
  83.     There should be no assumptions about the positions of the buffers in
  84.     DRAM. It might be that the end addr of buffer 1 != start addr
  85.     of buffer 2.
  86.  
  87. 2)  The GUS SDK says in chapter
  88.  
  89.     2.6.2.14  Volume Ramp Control Register - (D,8D)
  90.  
  91.     about Bit 2, Rollover condition:
  92.  
  93.     "This bit pertains more towards the location of the voice rather than
  94.     its volume. Its purpose is to generate an IRQ and NOT stop (or loop).
  95.     It will generate an IRQ and the voice's address will continue to move
  96.     thru DRAM in the same direction. This can be a very powerful feature.
  97.     It allows the application to get an interrupt without having the sound
  98.     stop. This can be easily used to implement a ping-pong buffer algorithm
  99.     so an application can keep feeding it data and there will be no pops.
  100.     Even if looping is enabled, it will not loop."
  101.  
  102.     I thought that this feature might help. But I really don't understand,
  103.     how to "implement a ping-pong buffer algorithm" using this method.
  104.     Does someone have an idea on this?
  105.  
  106.  
  107. Please, if you do have some suggestions, tell it. I'm sure that the answers
  108. on these topics are of public interest.
  109.  
  110. Thank's a lot in advance,
  111.  
  112.  
  113.  
  114. -- 
  115. Andreas Vogel               Bahnhofstr. 13 / D-7300 Esslingen / Germany
  116.                 ab 1.7.1993:  73728 Esslingen
  117.                 Voice:  +49-711/3967133 (priv.: +49-711/357613)
  118.                 E-Mail: av@ssw.de
  119.  
  120. ------------------------------
  121.  
  122. End of GUS Programmer's Digest V2 #7
  123. ************************************
  124.  
  125. To post to tomorrow's digest:               <gus-sdk%itchy@dsd.es.com>
  126. To (un)subscribe or get help:       <gus-sdk-request%itchy@dsd.es.com>
  127. To contact a human (last resort):     <gus-sdk-owner%itchy@dsd.es.com>
  128.  
  129. FTP sites:         archive.epas.utoronto.ca         pub/pc/ultrasound
  130.                    wuarchive.wustl.edu       systems/msdos/ultrasound
  131. Hints:
  132.       - Get the FAQ from the FTP sites or the request server.
  133.       - Mail to <gus-sdk-request%itchy@dsd.es.com> for info about
  134.     other GUS related mailing lists (UNIX, OS/2, GUS-MIDI, etc.)
  135.  
  136.  
  137.  
  138.